home *** CD-ROM | disk | FTP | other *** search
File List | 1991-06-11 | 3.5 KB | 147 lines |
- sel_files("A:\")
- PROCEDURE sel_files(p$)
- '
- ' ************ FILE SELECTOR V1.2 **************
- '
- ' This procedure when passed the drive path by parameter will allow the
- ' user to select any number of files in that path with the mouse.
- '
- ' Requirements:
- ' - This procedure is only written for 80 column screens, (Medium
- ' and High resolution).
- '
- ' - The call to this procedure must pass the path by parameter!
- ' Examples:
- ' sel_files("A:\")
- ' sel_files("C:\GFA\PROGS\MYSTUFF\")
- '
- ' - The main program should have global or external variables with
- ' these names and dimensions:
- '
- ' fil$(n)
- ' fil_at(n)
- '
- ' Where 'n' is the maximum # of files allowed - a good number
- ' to use is 175 becuase that is the whole screen filled up!
- ' If there are more than 175 files in the path, then this code
- ' will have to be altered to allow more!
- '
- ' fil$() Holds the files in "no sort" order, starting with
- ' position 1. 0 is not used!
- '
- ' fil_at() Holds the flags for the corresponding files in fil$(),
- ' A value of -1 is selected, 0 is de-selected.
- '
- ' NOTE :
- ' If you do not have the above variables, please de-comment the
- ' next two code lines! (I can NOT guarantee this will let your
- ' program use them after the user exits this procedure!)
- '
- ' DIM fil$(175)
- ' DIM fil_at(175)
- '
- rez=XBIOS(4)
- IF rez=0
- PRINT
- PRINT CHR$(7);"SEL_FILES only works in med & high res!"
- PAUSE 100
- GOTO skipall
- ENDIF
- t$="TEMP.DIR"
- temp$=p$+t$
- p$=p$+"*.*"
- DIR p$ TO temp$
- OPEN "I",#1,temp$
- count=0
- just$=SPACE$(12)
- CLS
- fcount=1
- WHILE NOT EOF(#1)
- INPUT #1,f$
- IF f$=t$
- GOTO skip
- ENDIF
- fil$(fcount)=f$
- fil_at(fcount)=0 ! not selected
- INC fcount
- INC count
- LSET just$=f$
- IF count<7
- IF count=1
- PRINT "|";
- ENDIF
- PRINT just$;"|";
- ELSE
- count=1
- PRINT
- PRINT "|";just$;"|";
- ENDIF
- skip:
- WEND
- LINE 1,182*rez,639,182*rez
- LINE 1,183*rez,639,183*rez
- LINE 1,192*rez,639,192*rez
- LINE 1,193*rez,639,193*rez
- DEFTEXT 2,0,0,4
- TEXT 192,199*rez,"FILENAME"
- TEXT 300,199*rez,"CURRENT PATH"
- TEXT 480,199*rez,"FILES SELECTED"
- TEXT 6,189*rez,"RIGHT MOUSE BUTTON TO EXIT"
- HIDEM
- ' putm 96,4
- SHOWM
- ox=MOUSEX
- oy=MOUSEY
- REPEAT
- MOUSE x,y,k
- selx=INT((x/(13*8))+1)
- sely=INT((y/(8*rez))+1)
- sel=(((sely-1)*6)+selx)
- IF k=1
- IF fil$(sel)=""
- PRINT CHR$(7);
- GOTO skip2
- ENDIF
- IF fil_at(sel)=0
- IF rez=2
- PRINT CHR$(27)+"p";
- ELSE
- PRINT CHR$(27)+"b1";
- ENDIF
- fil_at(sel)=-1
- INC fsel
- ELSE
- IF rez=2
- PRINT CHR$(27)+"q";
- ELSE
- PRINT CHR$(27)+"b3";
- ENDIF
- fil_at(sel)=0
- DEC fsel
- ENDIF
- PRINT AT(((selx-1)*13+2),sely);just$
- force=-1
- PAUSE 5
- ENDIF
- IF (NOT (selx=ox AND sely=oy))
- force=-1
- ENDIF
- IF force=-1
- force=0
- LSET just$=fil$(sel)
- IF rez=2
- PRINT CHR$(27)+"q";
- ELSE
- PRINT CHR$(27)+"b3";
- ENDIF
- PRINT AT(22,24);"|";just$;"|";p$,"| ";fsel;" ";
- ox=selx
- oy=sely
- SHOWM
- ENDIF
- skip2:
- UNTIL k=2
- CLOSE #1
- skipall:
- RETURN
-